using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace Oops.Xna.Framework
{
	/// <summary>
	/// Provides data for the events of the <see cref="GameComponentCollection"/> and <see cref="KeyedGameComponentCollection"/> classes.
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public class GameComponentCollectionEventArgs<T> : EventArgs where T : IGameComponent
	{
		private T item;

		/// <summary>
		/// Initializes a new instance of the <see cref="GameComponentCollectionEventArgs&lt;T&gt;"> class."/>
		/// </summary>
		internal GameComponentCollectionEventArgs()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="GameComponentCollectionEventArgs&lt;T&gt;"> class
		/// specifying an associated <see cref="Microsoft.Xna.Framework.IGameComponent"/> instance."/>
		/// </summary>
		internal GameComponentCollectionEventArgs(T item)
		{
			// The item parameter must be specified.
			if (item == null)
			{
				throw new ArgumentNullException("item");
			}

			// Hold onto parameters.
			this.item = item;
		}

		/// <summary>
		/// Gets the associated <see cref="Microsoft.Xna.Framework.IGameComponent"/>.
		/// </summary>
		public T Item
		{
			get { return this.item; }
			internal set { this.item = value; }
		}
	}
}
